fixing potential bugs