added panic, some bugfixes