Some small bug fixes thanks to ARG and @illori

Signed-off-by: Bryan Deakin <runic@simplemachines.org>