added extension check, bugfixes