I'm trying to remember a movie I watched as a kid. I only remember bits and pieces. It is an animated movie about a boy that goes to a castle and in the beginning he rides around on a train, later on at the king's party he takes the magical scepter or a key or something and opens a forbidden door and lets out an evil black thing and he has to rescue the king and the people and he rides on a magical flying bed. I'm sure I'm probably wring on most of these things but if someone has an idea of what movie I'm talking about it would be great!. Thanks!