Fixed some nagging bugs