empty() shouldn't be used like that unless you're using php 5.4
also, some annoying bugs...

Signed-off-by: Suki <suki@missallsunday.com>