Moved parameter checks to the correct place

Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>